package com.sc.nft.entity.vo.ecology;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.sc.nft.enums.EcologyExpendType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

@Data
public class ExpendEcologyCastRecordsVO {
    @ApiModelProperty(value = "消耗类型 ECOLOGY_POINTS:生态燃料 EQUITY_PROPS:权益道具")
    private EcologyExpendType expendType;

    @ApiModelProperty(value = "铸造数量")
    private Integer castCount;

    @ApiModelProperty(value = "藏品名称")
    private String collectionName;

    @ApiModelProperty(value = "消耗名称")
    private String expendName;

    @ApiModelProperty(value = "消耗类型图片")
    private String expendImage;

    @ApiModelProperty(value = "消耗数量")
    private String expendCount;

    @ApiModelProperty(value = "消耗时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;


    public void setExpendCount(BigDecimal expendCount) {
        if(expendType == EcologyExpendType.ECOLOGY_POINTS){
            this.expendCount = expendCount.setScale(2,BigDecimal.ROUND_DOWN).toPlainString();
        }else{
            this.expendCount = expendCount.stripTrailingZeros().toPlainString();
        }
    }
}
